<?php

declare(strict_types=1);

namespace App\CustHub\Mapper;

use App\CustHub\Model\ChContactWhite;
use Mine\Abstracts\AbstractMapper;

/**
 * 客户白名单
 */
class ChContactWhiteMapper extends AbstractMapper
{
    public function assignModel()
    {
        $this->model = ChContactWhite::class;
    }


    /**
     * 检查客户是否存在
     * @param string $userId
     * @param int $mainUid
     * @return bool
     */
    public function checkContactExists(string $userId,int $mainUid): bool
    {
        return $this->model::query()
            ->where('main_uid',$mainUid)
            ->where('user_id',$userId)
            ->exists();
    }
}